class FullDate < ActiveRecord::Base
  has_many :artist_dates, :dependent => :destroy
  has_many :membership_dates, :dependent => :destroy

  #validate :valid_date?

  #Constants
  MONTH_ARRAY = Array.new([['', 0],['January', 1],
                      ['February', 2],
                      ['March', 3],
                      ['April', 4],
                      ['May', 5],
                      ['June', 6],
                      ['July', 7],
                      ['August', 8],
                      ['September', 9],
                      ['October', 10],
                      ['November', 11],
                      ['December', 12]])
  
  def to_s
    String result = ""
    if month
      result << month.to_s + "-"
    end
    if day
      result << day.to_s + "-"
    end
    result << year.to_s

    return result
  end

  def with_month
    String result = ""
    if month
      result << Date::MONTHNAMES.fetch(month) + "-"
    end
    if day
      result << day.to_s + "-"
    end
    result << year.to_s

    return result
  end

  private

  def valid_date?
  # if month = 1,3,5,7,8,10,12
  #  1 <= day <= 31
  # if month = 4,6,9,11
  #  1 <= day <= 30
  # if month = 2
  #  1 <= day <= 29   we don't care about leap years    
  end

end
